<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

/**
 * Class CreateConfigTable
 *  生成迁移: php artisan make:migration create_auth_group_table
 *  运行迁移: php artisan migrate
 */
class CreateAuthGroupTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('auth_group', function (Blueprint $table) {
            $table->increments('group_id')->comment('编号');
            $table->string('title',100)->comment('名称');
            $table->text('rules')->nullable(true)->comment('规则');
            $table->integer('addtime')->comment('添加时间');
        });
        $prefix = DB::getConfig('prefix');
        DB::statement("ALTER TABLE `{$prefix}auth_group` comment '管理员分组表'"); // 表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('auth_group');
    }
}
